#include <bits/stdc++.h>
#define int long long
using namespace std;
int n,r[100005],cnt,h[100005],s,l,x2,h2[100005],sum[100005];
signed main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin >> n;
    for(int i = 1;i <= n;i++)
    {
        cin >> r[i];
        h[r[i]]++;
        h2[r[i]]++;
    } 
    sort(r + 1,r + n + 1);
    int s = h[r[n]];
    for(int i = 1;i <= n - s;i += l)
    {
        l = h[r[i]];
        int x1 = i;
        int y = i + h[r[i]];
        int x = 0;
        x = min(h[r[x1]],h[r[y]]);
        x2 = x;
        cnt += x;
        h[r[x1]] = max(h[r[x1]] - x,(int)0);
    }
    h[r[n]] -= x2;
    for(int i = 1 + h2[r[1]];i <= n;i += h2[r[i]])
    {
        for(int j = 1;j <= i - h2[r[i]];j += h2[r[i]])
        {
            if(h[r[i]] > 0)
            {
                int x3 = min(h[r[i]],h[r[j]]);
                cnt += x3;
                h[r[i]] -= x3;
                h[r[j]] -= x3;
            }
        }
    }
    cout << n - cnt << endl;
    return 0;
}